#ifndef CommonDef_H
#define CommonDef_H

//SPL 2010
//Assignment 2
//commonDef.h

//Last change 17/12/09
//changes: fix the order in the enum.
//add some students requests.

//DO NOT CHANGE THE ENUM AND STRUCTURE IN THIS FILE!

#define ASS2_LINUX

#include <string>


namespace ass2{

	enum eUser{
		eAlon,
		eCherny,
		eGorovoy,
		eGutman,
		eKatz,
		ePoster,
		eSaya,
		eSoref,
		eToman,
		eWeis,
		eZolotowski,

		eNoUser,
	};

	inline std::string eUserName(eUser user)
	{
		switch (user){
			case eAlon :		    return "Alon";
			case eGorovoy :		    return "Gorovoy";
			case eCherny :		    return "Cherny";
			case eGutman :		    return "Gutman";
			case eKatz :			return "Katz";
			case ePoster :	        return "Poster";
			case eSoref :			return "Soref";
			case eToman :           return "Toman";
			case eWeis :            return "Weis";
			case eZolotowski :      return "Zolotowski";
			case eSaya :            return "Saya";
			default :				return "Unknown user";
		}
	}

	inline int eUserId(eUser user)
	{
		switch (user){
			case eAlon :		    return 13;
			case eCherny :		    return 19;
			case eGorovoy :		    return 22;
			case eGutman :		    return 32;
			case eKatz :			return 51;
			case ePoster :	        return 59;
			case eSaya :            return 62;
			case eSoref :			return 75;
			case eToman :           return 88;
			case eWeis :            return 95;
			case eZolotowski :      return 99;
			default :				return 0;
		}
	}

	enum eEnergy
	{
		coal,
		gas,
		hug,
		oil,
		smile,
		sun,
		wind,
		noEnergy
	};

	struct unitContainer{
		int oil;
		int gas;
		int coal;
		int sun;
		int wind;
		int smile;
		int hug;
	};

	struct valueContainer{
		double oil;
		double gas;
		double coal;
		double sun;
		double wind;
		double smile;
		double hug;
	};



	enum eColor	{
		BLACK  = 0x0,
		DARK_BLUE = 0x1,
		DARK_GREEN =  0x2,
		DARK_CYAN = 0x3,
		DARK_RED = 0x4,
		DARK_PURPLE = 0x5,
		DARK_YELLOW = 0x6,
		WHITE = 0x7,
		GRAY = 0x8,
		BLUE = 0x9,
		GREEN = 0xA,
		CYAN = 0xB,
		RED = 0xC,
		PURPLE = 0xD,
		YELLOW = 0xE,
		BRIGHT_WHITE = 0xF,
	};

	inline std::string colorLinux(eColor color)
		{
			switch (color){
			case (BLACK): return "\033[22;30m";
			case (RED): return "\033[22;31m";
			case (GREEN): return "\033[22;32m";
			case (DARK_GREEN): return "\033[22;33m"; //BROWN
			case (BLUE): return "\033[22;34m";
			case (DARK_BLUE): return "\033[22;35m";  //MAGENTA
			case (CYAN): return "\033[22;36m";
			case (GRAY): return "\033[22;37m";
			case (DARK_PURPLE): return "\033[01;30m"; //- dark gray
			case (DARK_RED): return "\033[01;31m"; //- light red
			case (DARK_YELLOW): return "\033[01;32m";// - light green
			case (YELLOW): return "\033[01;33m";// - yellow
			/*case (RED): return "\033[01;34m - light blue
			case (RED): return "\033[01;35m - light magenta
			case (RED): return "\033[01;36m - light cyan*/
			case (WHITE): return "\033[01;37m";

			default :				return "\033[01;37m";
			}
		}


		//students requestes


		inline eEnergy stringToEnrgy(std::string name)
		{
			if 		("coal" == name)	return coal;
			else if ("gas"  == name) 	return gas;
			else if ("hug"  == name)	return hug;
			else if ("oil"  == name)	return oil;
			else if ("smile"== name)	return smile;
			else if ("sun"  == name) 	return sun;
			else if ("wind" == name) 	return wind;
			else                        return noEnergy;
		}

		inline std::string energyToString(eEnergy energy)
	{
		switch (energy){
			case  coal:		    return "coal";
			case  hug:		    return "hug";
			case  gas:		    return "gas";
			case  oil:		    return "oil";
			case  smile:		return "smile";
			case  sun:		    return "sun";
			case  wind:		    return "wind";
			default :			return "Unknown energy";
		}
	}
};//namespace
#endif
